// 收货地址管理模块
import type { AddressItem } from '@/types/address'
import { defineStore } from 'pinia'
import { ref } from 'vue'


export const useAddressStore = defineStore('address', () => {
  const selectedAddress = ref<AddressItem>()

  const changeSelectedAddress = (val: AddressItem) => {
    selectedAddress.value = val
  }
  // 定义商品详情新建立的地址 和开关
  const newAddressId = ref<string>('0')
  const changeNewAddressId = (id: string) => {
    newAddressId.value = id
  }
  return {
    selectedAddress,
    changeSelectedAddress,
    newAddressId,
    changeNewAddressId
  }

})





